package com.ali.juejin.adapter

import android.content.Context
import com.ali.juejin.BR
import com.ali.juejin.R
import com.ali.juejin.base.BaseModelAdapter
import com.ali.juejin.bean.v1.DateTag
import com.ali.juejin.databinding.ItemTagBinding
import com.ali.juejin.model.main.HotListModel

class HomeRecommendTagsAdapter(val mRecomContext: Context, br:Int,model:HotListModel):BaseModelAdapter<ItemTagBinding, DateTag,HotListModel>(mRecomContext,br,model) {

    override fun getLayout(): Int {
        return R.layout.item_tag
    }

    override fun getDataList(): ArrayList<DateTag> {
        return arrayListOf(
            DateTag(3,"3日内"),
            DateTag(7,"7日内"),
            DateTag(30,"30日内"),
            DateTag(0,"全部")
        )
    }

    override fun itemViewHandler(holder: ListHolder<ItemTagBinding>, position: Int) {
        holder.itemView.setOnClickListener {
            model.selectedTag.postValue(list[position])
            notifyDataSetChanged()
        }
        holder.getBinding().setVariable(BR.recommendModel,model)
        super.itemViewHandler(holder, position)
    }
}